﻿using System.CodeDom.Compiler;
using System.Collections.Generic;

namespace NBuild.Fx.Engine
{
    public sealed class NBuildCompilerError
    {
        private readonly CompilerError _compilerError;

        internal NBuildCompilerError(CompilerError compilerError)
        {
            _compilerError = compilerError;
        }

        public int Column 
        {
            get { return _compilerError.Column; }
        }

        public string ErrorNumber
        {
            get { return _compilerError.ErrorNumber; }
        }

        public string ErrorText
        {
            get { return _compilerError.ErrorText; }
        }

        public bool IsWarning
        {
            get { return _compilerError.IsWarning; }
        }

        public int Line
        {
            get { return _compilerError.Line; }
        }
    }

    internal sealed class NBuildCompilerErrorCollection : List<NBuildCompilerError>
    {
        internal NBuildCompilerErrorCollection(CompilerResults compilerResults)
        {
            foreach (CompilerError compilerError in compilerResults.Errors)
                Add(new NBuildCompilerError(compilerError));
        }
    }
}
